package com.yanqu.road.server.cmd.orewar;

import com.yanqu.road.pb.cross.activity.CrossActivityProto;
import com.yanqu.road.pb.worldmessage.WorldMessageProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.orewar.CrossOreWarChatMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_CROSS_ORE_WAR_CHAT, desc = "跨服盐场聊天")
public class CrossOreWarChatCmd extends CrossCommand {
    private int activityId;
    private WorldMessageProto.WorldMessageTempMsg chatMsg;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        CrossActivityProto.CrossActivityChatReqMsg reqMsg = CrossActivityProto.CrossActivityChatReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        chatMsg = reqMsg.getMsg();
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossOreWarChatMgr.activityChat(activityId, chatMsg);
    }

    @Override
    public void sendData() {

    }
}
